package com.demo.serializer;

import java.lang.reflect.Type;

/**
 * 序列化原接口
 *
 */
public interface ISerializer {

    /**
     * Object转为byteArray
     * @param object
     * @return
     */
    byte[] toByteArray(Object object);

    /**
     * byte[] 转为Object
     * @param bytes
     * @param clazz
     * @return
     */
    <T> T toObject(byte[] bytes, Class<T> clazz);
    
    /**
     * byte[] 转为Object
     * @param bytes
     * @param type
     * @return
     */
    <T> T toObject(byte[] bytes, Type type);

    /**
     * 获取type
     * @return
     */
    SerializerType getType();
}
